package ru.susu.algebra.jtex;


/**
 * @author akargapolov
 * @since: 17.08.2010
 */
public class SimpleTexElementWithCode implements ITexElement
{
	private String _code;
	private String _name;

	private SimpleTexElementWithCode(String code, String name)
	{
		_code = code;
		_name = name;
	}

	@Override
	public String generateContent()
	{
		StringBuffer buffer = new StringBuffer();
		buffer.append("\\").append(_code).append("{").append(_name).append("}");
		return buffer.toString();
	}

	private static final String LABEL = "label";

	public static SimpleTexElementWithCode label(String name)
	{
		return new SimpleTexElementWithCode(LABEL, name);
	}

	private static final String REF = "ref";

	public static SimpleTexElementWithCode ref(String name)
	{
		return new SimpleTexElementWithCode(REF, name);
	}

	public static final String BIBITEM = "bibitem";

	public static SimpleTexElementWithCode bibitem(String name)
	{
		return new SimpleTexElementWithCode(BIBITEM, name);
	}

	private static final String TEXT = "text";

	public static String text(String text)
	{
		return new SimpleTexElementWithCode(TEXT, text).generateContent();
	}

}
